import { createApp } from 'vue'
import EleMentPlus from 'element-plus'
import 'element-plus/dist/index.css'
import App from './App.vue'
import router from './router'
import axios from 'axios'
import { createPinia } from 'pinia'
import { createPersistedState } from 'pinia-persistedstate-plugin'
import piniaPluginPersistedstate from 'pinia-plugin-persistedstate'

import Vue3StarrySky from 'vue3-starry-sky'
import 'vue3-starry-sky/lib/style.css';
// 如果您正在使用CDN引入，请删除下面一行。
import * as ElementPlusIconsVue from '@element-plus/icons-vue'
import SvgIcon from '@/components/svgIcon/index.vue'
// 导入Svg图片插件
import 'virtual:svg-icons-register'
// 路由守卫
import './router/permit'



const app = createApp(App)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
    app.component(key, component)
}
// pinia
const pinia = createPinia();
// const persist = createPersistedState()
pinia.use(piniaPluginPersistedstate);
app.use(pinia);
// 注册图标组件
app.component('svg-icon', SvgIcon)
app.config.globalProperties.$axios = axios
app.use(router)
    .use(EleMentPlus)
    .use(Vue3StarrySky);

app.mount('#app')
